package com.lsq.lwf.common.filter;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

import com.lsq.lwf.common.frame.BaseFrame;
import com.lsq.lwf.common.utils.Init;
import com.lsq.lwf.common.xmlparse.base.BaseXml;

public class LightwightFilter extends BaseXml implements Filter {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private FilterConfig config;

	public void destroy() {
		this.setConfig(null);
	}

	public void doFilter(ServletRequest request, ServletResponse response,
			FilterChain chain) throws IOException, ServletException {
		
		//执行方法
		BaseFrame.execute(request,response);
	}

	public void init(FilterConfig filterConfig) throws ServletException {
		
		this.setConfig(filterConfig);
		//初始化配置文件
		new Init(config);
	}

	public FilterConfig getConfig() {
		return config;
	}

	public void setConfig(FilterConfig config) {
		this.config = config;
	}

}
